Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hdffv 11052 #2303

Merged
merged 7 commits into from
Dec 15, 2022
Merged

Hdffv 11052 #2303

merged 7 commits into from
Dec 15, 2022

Conversation

vchoi-hdfgroup
Copy link
Contributor

No description provided.

vchoi and others added 4 commits December 12, 2022 15:32
… producing a core dump.

When h5debug closes the corrupted file, the library calls H5F__dest() which performs all the
closing operations for the file "f" (H5F_t *) but just keeping note of errors in "ret_value"
all the way till the end of the routine.  The user-provided corrupted file has an illegal
file size causing failure when reading the image during the closing process.
At the end of this routine it sets f->shared to NULL and then frees "f".
This is done whether there is error or not in "ret_value".
Due to the failure in reading the file earlier, the routine then returns error.
The error return from H5F__dest() causes the file object "f" not being removed from the
ID node table.  When the library finally exits, it will try to close the
file objects in the table.  This causes assert failure when H5F_ID_EXISTS(f) or H5F_NREFS(f).
Fix:
a) H5F_dest(): free the f only when there is no error in "ret_value" at the end of the routine.
b) H5VL__native_file_close(): if f->shared is NULL, free "f"; otherwise, perform closing on "f" as before.
c) h5debug.c main(): track error return from H5Fclose().
@derobins derobins merged commit 0cb5808 into HDFGroup:develop Dec 15, 2022
derobins added a commit to derobins/hdf5 that referenced this pull request Dec 20, 2022
b9244a8 Align arg types of H5D_chunk_iter_op_t with H5Dget_chunk_info (HDFGroup#2074)
70cf2c3 Removed idioms and misc. text clean-up (HDFGroup#2320)
8102fa8 Only document Fortran functions (HDFGroup#2319)
784061b moved onion VFD to FAPL group (HDFGroup#2321)
6b6bcde Hdffv 11052 (HDFGroup#2315)
10c693a Update hdf5_header.html
0cb5808 Hdffv 11052 (HDFGroup#2303)
a1c81ed added doc. warning for H5Literate_async return value (HDFGroup#2295)
502b32b Updated H5ES documenation (HDFGroup#2293)
a903600 Fix for HDFFV-11052: h5debug fails on a corrupted file (h5_nrefs_POC)… (HDFGroup#2291)
derobins added a commit to derobins/hdf5 that referenced this pull request Dec 20, 2022
b9244a8 Align arg types of H5D_chunk_iter_op_t with H5Dget_chunk_info (HDFGroup#2074)
70cf2c3 Removed idioms and misc. text clean-up (HDFGroup#2320)
8102fa8 Only document Fortran functions (HDFGroup#2319)
784061b moved onion VFD to FAPL group (HDFGroup#2321)
6b6bcde Hdffv 11052 (HDFGroup#2315)
10c693a Update hdf5_header.html
0cb5808 Hdffv 11052 (HDFGroup#2303)
a1c81ed added doc. warning for H5Literate_async return value (HDFGroup#2295)
502b32b Updated H5ES documenation (HDFGroup#2293)
a903600 Fix for HDFFV-11052: h5debug fails on a corrupted file (h5_nrefs_POC)… (HDFGroup#2291)
derobins added a commit that referenced this pull request Dec 21, 2022
b9244a8 Align arg types of H5D_chunk_iter_op_t with H5Dget_chunk_info (#2074)
70cf2c3 Removed idioms and misc. text clean-up (#2320)
8102fa8 Only document Fortran functions (#2319)
784061b moved onion VFD to FAPL group (#2321)
6b6bcde Hdffv 11052 (#2315)
10c693a Update hdf5_header.html
0cb5808 Hdffv 11052 (#2303)
a1c81ed added doc. warning for H5Literate_async return value (#2295)
502b32b Updated H5ES documenation (#2293)
a903600 Fix for HDFFV-11052: h5debug fails on a corrupted file (h5_nrefs_POC)… (#2291)
derobins added a commit that referenced this pull request Dec 21, 2022
* Brings the following changesets over from develop:

b9244a8 Align arg types of H5D_chunk_iter_op_t with H5Dget_chunk_info (#2074)
70cf2c3 Removed idioms and misc. text clean-up (#2320)
8102fa8 Only document Fortran functions (#2319)
784061b moved onion VFD to FAPL group (#2321)
6b6bcde Hdffv 11052 (#2315)
10c693a Update hdf5_header.html
0cb5808 Hdffv 11052 (#2303)
a1c81ed added doc. warning for H5Literate_async return value (#2295)
502b32b Updated H5ES documenation (#2293)
a903600 Fix for HDFFV-11052: h5debug fails on a corrupted file (h5_nrefs_POC)… (#2291)

* Brings the following changes over from develop:

c1e44d3 Fix doxygen warnings and remove javadocs (#2324)
149b8e9 Disable hl tools by default (#2313)
vchoi-hdfgroup added a commit to vchoi-hdfgroup/hdf5 that referenced this pull request May 9, 2023
* Fix for HDFFV-11052: h5debug fails on a corrupted file (h5_nrefs_POC) producing a core dump.
When h5debug closes the corrupted file, the library calls H5F__dest() which performs all the
closing operations for the file "f" (H5F_t *) but just keeping note of errors in "ret_value"
all the way till the end of the routine.  The user-provided corrupted file has an illegal
file size causing failure when reading the image during the closing process.
At the end of this routine it sets f->shared to NULL and then frees "f".
This is done whether there is error or not in "ret_value".
Due to the failure in reading the file earlier, the routine then returns error.
The error return from H5F__dest() causes the file object "f" not being removed from the
ID node table.  When the library finally exits, it will try to close the
file objects in the table.  This causes assertion failure from (f->file_id > 0).
Fix:
a) H5F__dest(): free the f only when there is no error in "ret_value" at the end of the routine.
b) H5F__close_cb(): if f->shared is NULL, free "f"; otherwise, perform closing on "f" as before.
c) h5debug.c main(): track error return from H5Fclose().

* Committing clang-format changes

* Add test and release note info for fix to HDFFV-11052 which is merged via PR#2291.

* Committing clang-format changes

* Add the test file to Cmake.

Co-authored-by: vchoi <vchoi@jelly.ad.hdfgroup.org>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
brtnfld pushed a commit to brtnfld/hdf5 that referenced this pull request May 17, 2023
* Fix for HDFFV-11052: h5debug fails on a corrupted file (h5_nrefs_POC) producing a core dump.
When h5debug closes the corrupted file, the library calls H5F__dest() which performs all the
closing operations for the file "f" (H5F_t *) but just keeping note of errors in "ret_value"
all the way till the end of the routine.  The user-provided corrupted file has an illegal
file size causing failure when reading the image during the closing process.
At the end of this routine it sets f->shared to NULL and then frees "f".
This is done whether there is error or not in "ret_value".
Due to the failure in reading the file earlier, the routine then returns error.
The error return from H5F__dest() causes the file object "f" not being removed from the
ID node table.  When the library finally exits, it will try to close the
file objects in the table.  This causes assert failure when H5F_ID_EXISTS(f) or H5F_NREFS(f).
Fix:
a) H5F_dest(): free the f only when there is no error in "ret_value" at the end of the routine.
b) H5VL__native_file_close(): if f->shared is NULL, free "f"; otherwise, perform closing on "f" as before.
c) h5debug.c main(): track error return from H5Fclose().

* Committing clang-format changes

* Add test and release note info for fix to HDFFV-11052 which is merged via PR#2291.

* Committing clang-format changes

* Add the test file to Cmake.

Co-authored-by: vchoi <vchoi@jelly.ad.hdfgroup.org>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants